package com.beta.elephant.vo;

/**
 * 分页结果结构类
 *
 * @author kevin_zhang
 */
public class PageResultVO<T> extends ResultVO {
    private long totalCount = 0L;
    private long totalPage = 0L;
    private int currentPageNo = 0;

    public PageResultVO() {
        this.setCode(200);
        this.setMsg("成功");
    }

    public long getTotalCount() {
        return this.totalCount;
    }

    public void setTotalCount(long totalCount, int pageSize) {
        this.totalCount = totalCount < 0L ? 0L : totalCount;
        long count = 0L;
        if (pageSize > 0) {
            count = this.totalCount / (long) pageSize;
            if (this.totalCount % (long) pageSize > 0L) {
                ++count;
            }
        }

        this.setTotalPage(count);
    }

    public long getTotalPage() {
        return this.totalPage;
    }

    public void setTotalPage(long totalPage) {
        this.totalPage = totalPage;
    }

    public int getCurrentPageNo() {
        return currentPageNo;
    }

    public void setCurrentPageNo(int currentPageNo) {
        this.currentPageNo = currentPageNo;
    }
}
